#include "instructionwidget.h"

instructionwidget::instructionwidget(QWidget *parent) : QWidget(parent)
{
    QPixmap p2=QPixmap("3.png");
    interface.setPixmap(p2);

    int x=p2.width(),y=p2.height();

    QPixmap pic1=QPixmap("Tom.png");
    picture[0].setPixmap(pic1);

    QPixmap pic2=QPixmap("Jerry.png");
    picture[1].setPixmap(pic2);


    instruction[0].setText("Tom，一只蓝灰色家猫,穿上帘子意外学会飞行。");
    instruction[0].setParent(&interface);
    instruction[1].setText("Jerry，一只棕毛花枝鼠，坐在土块上被Tom击飞。");
    instruction[1].setParent(&interface);
    instruction[2].setText("通过W,S,A,D键进行上下左右移动，Q：向上瞬移，Z：向下瞬移");
    instruction[2].setParent(&interface);


    instruction[0].setFixedSize(100,100);
    instruction[1].setFixedSize(100,100);
    instruction[2].setFixedSize(100,100);

    instruction[0].setAlignment(Qt::AlignLeft | Qt::AlignTop);
    instruction[1].setAlignment(Qt::AlignLeft | Qt::AlignTop);
    instruction[2].setAlignment(Qt::AlignLeft | Qt::AlignTop);

    instruction[0].setWordWrap(true);
    instruction[1].setWordWrap(true);
    instruction[2].setWordWrap(true);

    instruction[0].setStyleSheet("background-color:white; border: black;font-family: 楷体; font-size: 15px; color: #4148FF;");
    instruction[1].setStyleSheet("background-color:white; border: black;font-family: 楷体; font-size: 15px; color: #4148FF;");
    instruction[2].setStyleSheet("background-color:transparent; border: black;font-family: 楷体; font-size: 15px; color: #4148FF;");

    back.setText("返回");
    back.setParent(&interface);

    back.setFixedSize(80,30);
    back.setStyleSheet("background-color: none; border: none;font-family: 楷体; font-size: 30px; color: #F33333;");
    back.move((x-100), y*0.75);
    connect(&back,SIGNAL(clicked()),this,SLOT(close()));

    QVBoxLayout *mainbox=new QVBoxLayout,*finalbox=new QVBoxLayout;
    mainbox->addWidget(&interface);

    QHBoxLayout *threepic=new QHBoxLayout,*threeins=new QHBoxLayout,*box=new QHBoxLayout;

    instruction[2].move(300,50);

    threepic->addWidget(&picture[0]);
    threepic->addWidget(&picture[1]);

    threeins->addWidget(&instruction[0]);
    threeins->addWidget(&instruction[1]);

    finalbox->addLayout(threepic);
    finalbox->addLayout(threeins);

    box->addLayout(finalbox);
    box->addWidget(&back,50,Qt::AlignBottom);

    interface.setLayout(box);

    this->setLayout(mainbox);

}

instructionwidget::~instructionwidget()
{
}
